//
//  InfoBottomView.m
//  ejiaqingAlertView
//
//  Created by 杨攀 on 16/10/13.
//  Copyright © 2016年 CMIG. All rights reserved.
//

#import "InfoBottomView.h"
#import <Masonry.h>
@interface InfoBottomView ()

/** payBtn */
@property (nonatomic,strong) UIButton *payBtn;
/** addCartBtn */
@property (nonatomic,strong) UIButton *addCartBtn;

@end

@implementation InfoBottomView

- (instancetype)init
{
    if (self = [super init]) {
        [self initUI];
    }
    return self;
}
- (void)initUI{
    _addCartBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_addCartBtn setTitle:@"加入购物车" forState:UIControlStateNormal];
    [_addCartBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    _addCartBtn.backgroundColor = [UIColor whiteColor];
    _addCartBtn.layer.cornerRadius = 5.f;
    _addCartBtn.layer.masksToBounds = YES;
    _addCartBtn.layer.borderWidth = 1.f;
    _addCartBtn.layer.borderColor = [UIColor redColor].CGColor;
    [self addSubview:_addCartBtn];
    
    _payBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_payBtn setTitle:@"立即支付" forState:UIControlStateNormal];
    _payBtn.backgroundColor = [UIColor redColor];
    _payBtn.layer.cornerRadius = 5.f;
    _payBtn.layer.masksToBounds = YES;
    [self addSubview:_payBtn];
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    [_addCartBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
//        make.right.equalTo(_payBtn.mas_right).offset(-10);
        make.centerY.equalTo(self);
        make.height.equalTo(@45);
        make.width.equalTo(_payBtn.mas_width);
    }];
    
    [_payBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.left.equalTo(_addCartBtn.mas_right).offset(10);
        make.centerY.equalTo(self);
        make.height.equalTo(_addCartBtn.mas_height);
    }];
}
@end
